<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>新增员工</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="新增员工">
	<meta http-equiv="description" content="This is my page">

  </head>
  
  <body>
    <center>
    	<s:form name="frm" id="frm" method="post" action="" namespace="">
    	
    		<jsp:include page="/jsp/outward/business/common/menuLink.jsp">
    			<jsp:param name="menuLink" value="[{'name':'主数据'},{'name':'员工管理'},{'name':'保存员工'}]"/>
    			<jsp:param name="width" value="50%"/>
    		</jsp:include>
    		
    		<s:hidden id="employeeId" name="employee.id"></s:hidden>
    		
    		<table width="100%" cellspacing="1" cellpadding="3" bgcolor="#CCCCCC">
    			<tr bgcolor="#FFFFFF">
    				<td width="15%" align="right" class="label">
    					员工编号：
    				</td>
    				<td width="35%" align="left">
    					<s:textfield id="employeeNum" name="employee.employeeNum" cssStyle="width:98%"></s:textfield>
    				</td>
    				<td width="15%" align="right" class="label">
    					员工姓名：
    				</td>
    				<td width="35%" align="left">
    					<s:textfield id="employeeName" name="employee.employeeName" cssStyle="width:98%"></s:textfield>
    				</td>
    			</tr>
    			<tr bgcolor="#FFFFFF">
    				<td align="right" class="label">
    					性别：
    				</td>
    				<td align="left">
    					<s:select list='#{"男":"男","女":"女"}' id="sex" name="employee.sex" cssStyle="width:80px"></s:select>
    				</td>
    				<td align="right" class="label">
    					职务：
    				</td>
    				<td align="left">
    					<s:textfield id="job" name="employee.job" cssStyle="width:98%"></s:textfield>
    				</td>
    			</tr>
    			<tr bgcolor="#FFFFFF">
    				<td align="right" class="label">
    					出生年月：
    				</td>
    				<td align="left">
    					<input type="text" id="birthday" name="employee.birthday" value="<s:date name='employee.birthday' format='yyyy-MM-dd' />" style="width:120px" class="WDate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" />
    				</td>
    				<td align="right" class="label">
    				</td>
    				<td align="left">
    				</td>
    			</tr>
    		</table>
    		
    		<table width="100%" cellspacing="0">
    			<tr>
    				<td align="center" valign="bottom" height="30">
    					<input type="button" value="保存" class="btn" onclick="saveObj()" />
    				</td>
    			</tr>
    		</table>
    		
    	</s:form>
    </center>
    
    <script type="text/javascript">
    function saveObj()
    {
        var employeeName = $('#employeeName');
        var employeeNum = $('#employeeNum');
        if(!isNotNull(employeeName.val()))
        {
            showMsg('员工姓名不能为空。', function(){employeeName.focus();});
            return;
        }
        if(!isNotNull(employeeNum.val()))
        {
            showMsg('员工编号不能为空。', function(){employeeNum.focus();});
            return;
        }
        var url = 'inner/masterData/saveEmployee.action';
        ajaxAction(url, 'post', 'frm', true, function(result){
            var obj = eval(result);
            if('success' == obj.result)
            {
                window.opener.searchThis();
				window.close();
            }
            else
            {
                showMsg(obj.message);
            }
        });
    }
    </script>
    
  </body>
</html>
